import axios from "axios"

const actions = {
    async addSaying({commit}){
        const result = await axios.get('http://poetry.apiopen.top/sentences')
        commit('ADD_SAYING',result.data.result.name)
    }
}

const mutations = {
    ADD_SAYING(state,value){
        state.sayingList.push(value)
    }
}

const state = {
    sayingList:[
        'vue加油,做最好的自己'
    ]
}

const getters = {
    total(state){
        return state.sayingList.length
    }
}

export default {
    namespaced:true,
    actions,
    mutations,
    state,
    getters
}